﻿using PetaPoco;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Tunynet;
using Tunynet.Caching;

namespace Spacebuilder.Common
{
    /// <summary>
    /// 短信设置
    /// </summary>
    [TableName("tn_SmsSettings")]
    [PrimaryKey("id", autoIncrement = false)]
    [CacheSetting(true)]
    [Serializable]
    public class SmsSettings : SerializablePropertiesBase, IEntity
    {

        /// <summary>
        /// 创建一个对象
        /// </summary>
        /// <returns></returns>
        public static SmsSettings New() 
        {
            return new SmsSettings()
            {
                EnableSms=true
            };
        }


        #region 持久化数据
        /// <summary>
        /// ID
        /// </summary>
        public int id { get; set; }

        /// <summary>
        /// 短信账号用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 短信账号密码
        /// </summary>
        public string PassWord { get; set; }

        /// <summary>
        /// 是否开启短信
        /// </summary>
        public bool EnableSms { get; set; }

        /// <summary>
        /// 短信地址
        /// </summary>
        public string UserSmslAddress { get; set; }

        /// <summary>
        /// 短信平台的名字
        /// </summary>
        public string SmsName { get; set; }

        #endregion

        #region IEntity 成员

        object IEntity.EntityId { get { return this.id; } }

        bool IEntity.IsDeletedInDatabase { get; set; }

        #endregion
    }
}
